package com.jerry.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.locks.ReentrantReadWriteLock;

@Data
@Slf4j
@Configuration
@ConfigurationProperties("discovery")
public class DiscoveryConfig {
    private String serverHost;
    private Integer serverPort;
    private String serviceId;

    //private String schema;
    public String getServerAddress() {
        log.info("{}",serverHost);
        log.info("{}",serverPort);
        return String.format("http://%s:%s", serverHost, serverPort);
    }

    @Bean
    public ScheduledExecutorService scheduledExecutorService() {
        return Executors.newScheduledThreadPool(20);
    }


}
